// import './index.scss';
import XHeader from 'vux/src/components/x-header/index.vue'
import Tab from 'vux/src/components/tab/tab.vue'
import TabItem from 'vux/src/components/tab/tab-item.vue'
import Swiper from 'vux/src/components/swiper/swiper.vue'
import SwiperItem from 'vux/src/components/swiper/swiper-item.vue'
import XButton from 'vux/src/components/x-button/index.vue'
import Flexbox from 'vux/src/components/flexbox/flexbox.vue'
import FlexboxItem from 'vux/src/components/flexbox/flexbox-item.vue'
import XProgress from 'vux/src/components/x-progress/index.vue'
import Popup from 'vux/src/components/popup/index.vue'
import Group from 'vux/src/components/group/index.vue'
import Cell from 'vux/src/components/cell/index.vue'
import Checker from 'vux/src/components/checker/checker.vue'
import CheckerItem from 'vux/src/components/checker/checker-item.vue'
import XInput from 'vux/src/components/x-input/index.vue'
import XTextarea from 'vux/src/components/x-textarea/index.vue'
import TransferDom from 'vux/src/directives/transfer-dom/index'
import Alert from 'vux/src/components/alert/index.vue'
import VueQr from 'vue-qr'

import Checklist from 'vux/src/components/checklist/index.vue'
import wx from 'weixin-js-sdk'

import CONSTANT from '@/common/constants.js';
import http from '@/common/http.js';
// import Http from "../../common/http";

export default {
  name: 'Project',
  directives: {
    TransferDom
  },
  components: {
    XHeader,
    Tab,
    TabItem,
    Swiper,
    SwiperItem,
    XButton,
    Flexbox,
    FlexboxItem,
    XProgress,
    Popup,
    Group,
    Cell,
    Checker,
    CheckerItem,
    XInput,
    XTextarea,
    Checklist,
    Alert,
    VueQr
  },
  data () {
    return {
      index: 0,
      // 信息反馈是否有红点  为''的时候没有  为' '的时候有
      isXinxi: ' ',
      percent1: 60,
      show: false,
      demo: 10,
      isM: '募捐中',
      userId: '',
      eventType: '',
      feedBack: [],

      name: '',
      mobile: '',
      IDNum: '',
      liuyan: '',
      ifShowtt: false,
      address: '',

      item: 'item',
      textMoney: '',
      checkOK: true,
      isA: true,
      threshold: 50,
      minmovingdistance: 30,
      // 项目id
      event_id: '',
      together_id: '',
      // 显示哪一个模块
      witchShow: 'jilu',
      pageNoOther: 1,
      pageNoJuankuan: 1,
      pageSize: 20,
      eventAll: {},
      eventOther: [],
      eventJuankuan: [],
      lookMore: '查看更多',
      lookMoreJuankuans: '查看更多',
      leaveMessage: [],
      pageNoLeave: 1,
      isVolunteer: false,
      ifselected: false,
      configSuccess: false,
      qrcodeImg: '',
      showAlert: false,
      titleAlert: '长按二维码保存',
      logoSrc: this.imageUrl.imageUrl+'/userfiles/2/images/1513911875.png',
      dotScale: 1,
      logoMargin: 5,
      margin: 0,
      logoCornerRadius: 4,
      isID: function (value) {
        let r = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/
        if (r.test(value)) {
          return {
            valid: true,
            msg: '身份证正确'
          }
        } else {
          return {
            valid: false,
            msg: '身份证错误'
          }
        }
      }
    }
  },
  watch: {
    textMoney () {
      // this.demo = this.textMoney * 1
      // if (this.demo != 10 && this.demo != 20 && this.demo != 50 && this.demo != 100 && this.demo != 1000 && this.textMoney == this.demo) {
      //   this.ifselected = true
      // } else {
      //   this.ifselected = false
      // }
    }
  },
  mounted () {
    this.event_id = this.$route.query.event_id;
    this.together_id = this.$route.query.together_id;
    this.OtherJuankuans();
  },
  updated () {

  },
  methods: {
    comeBack () {
      window.history.go(-1)
    },
    moreOtherJuankuans () {
      // 查看更多捐款
      this.pageNoJuankuan++
      this.OtherJuankuans()
    },
    OtherJuankuans () {
      // 捐款记录
      http.post(CONSTANT.EVENT_DONATE, {
        event_id: this.event_id,
        together_id: this.together_id,
        pageNo: this.pageNoJuankuan,
        pageSize: this.pageSize
      }, (res) => {
        console.log(res)
      if (res.errmsg == '没有更多的项目') {
        this.pageNoJuankuan--
        this.lookMoreJuankuans = '没有更多的捐款记录了'
        return
      } else if (res.errmsg == '') {
        if (this.pageNoJuankuan == 1) {
          this.eventJuankuan = res.list
        } else {
          this.eventJuankuan = this.eventJuankuan.concat(res.list)
        }
      }
    })
    }

  }
}
// else if (_this.name == '') {
//   alert('请输入您的姓名！')
// } else if (_this.mobile == '') {
//   alert('请输入您的手机号！')
// } else if (_this.$refs.mobile.valid === false) {
//   alert('请输入正确的手机号')
// } else if (_this.IDNum == '') {
//   alert('请输入您的身份证号码！')
// } else if (_this.$refs.IDNum.valid === false) {
//   alert('请输入正确的身份证号码！')
// }
